import { createRequest } from '/@/api/service';
const module = process.env.APP_EDITION === 'hgy' ? 'ib/base/v1/user/' : 'ib/user/v1/user/';

/**
 * @function 用户登录
 * @param data
 * @param header
 * @returns {Promise}
 */
function USER_LOGIN(
  data: BaseUserLoginApi.UserLoginReq,
  header: object = {},
): Promise<BaseUserLoginApi.UserLoginResp> {
  return createRequest(`${process.env.APP_API_URL}${module}login`, data, header, 'POST');
}

/**
 * @function 发送登录验证码
 * @param data
 * @param header
 * @returns {Promise}
 */
function SEND_LOGIN_SMS(
  data: BaseUserLoginApi.SendLoginSmsReq,
  header: object = {},
): Promise<BaseUserLoginApi.SendLoginSmsResp> {
  return createRequest(`${process.env.APP_API_URL}${module}sendLoginSms`, data, header, 'POST');
}

export { USER_LOGIN, SEND_LOGIN_SMS };
